class Block {
    constructor(type, app) {
        this.app = app;
        switch (type) {
            case 'T1':
                this.color = '#000';
                this.coordinateGroup = [[0, 10], [0, 11], [1, 10], [1, 11]];
                this.type = 'T1';
                break;
            case 'T2':
                this.color = '#000';
                this.coordinateGroup = [[0, 8], [0, 9], [0, 10], [0, 11]];
                this.type = 'T2'
                break;
            case 'T3':
                this.color = '#000';
                this.coordinateGroup = [[1, 8], [1, 9], [0, 9], [0, 10]];
                this.type = 'T3'
                break;
            case 'T4':
                this.color = '#000';
                this.coordinateGroup = [[1, 8], [1, 9], [1, 10], [0, 9]];
                this.type = 'T4'
                break;
            case 'T5':
                this.color = '#000';
                this.coordinateGroup = [[0, 8], [1, 8], [1, 9], [1, 10]];
                this.type = 'T5'
                break;
        }
    }
    // 清空活动区域
    reset() {
        for (let i = 0; i < this.app.rowsCount; i++) {
            for (let j = 0; j < this.app.columnsCount; j++) {
                this.app.tetrisBox[i][j] = 0;
            }
        }
    }
    /**
     * 向左移动
     */
    moveLeft() {
        this.reset();
        for (let i = 0; i < this.coordinateGroup.length; i++) {
            this.coordinateGroup[i][1]--;
            this.app.tetrisBox[this.coordinateGroup[i][0]][this.coordinateGroup[i][1]] = 1;
        }
    }
    /**
     * 向右移动
     */
    moveRight() {
        this.reset();
        for (let i = 0; i < this.coordinateGroup.length; i++) {
            this.coordinateGroup[i][1]++;
            this.app.tetrisBox[this.coordinateGroup[i][0]][this.coordinateGroup[i][1]] = 1;
        }
    }
    /**
     * 向下移动
     */
    moveDown() {
        this.reset();
        for (let i = 0; i < this.coordinateGroup.length; i++) {
            this.coordinateGroup[i][0]++;
            this.app.tetrisBox[this.coordinateGroup[i][0]][this.coordinateGroup[i][1]] = 1
        }
    }
    /**
     * 旋转
     */
    rotate() {

    }
    canLeft() {

    }
    canRight() {

    }
    canDown() {

    }
    canRotate() {

    }
}
export default Block